# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=alpine-git-mirror-syncd
_shortname=git-mirror-syncd
pkgver=0.3.1
pkgrel=2
pkgdesc="Lua script that listens on MQTT and synchronizes Git mirrors when notified about changes"
url="https://github.com/jirutka/alpine-git-mirror-syncd"
arch="noarch"
license="MIT"
depends="ca-certificates git lua5.1 lua5.1-cjson lua5.1-mosquitto"
subpackages="$pkgname-openrc"
source="https://github.com/jirutka/alpine-git-mirror-syncd/archive/v$pkgver/alpine-git-mirror-syncd-$pkgver.tar.gz"
options="!check"  # upstream does not provide any tests yet

prepare() {
	default_prepare

	sed -i 's|^#!/usr/bin/env lua$|&5.1|' "$builddir"/*.lua
}

package() {
	install -D -m 755 $_shortname.lua "$pkgdir"/usr/bin/$_shortname
	install -D -m 644 config.lua.example "$pkgdir"/etc/$_shortname/config.lua
	install -D -m 755 etc/init.d/$_shortname "$pkgdir"/etc/init.d/$_shortname
	install -D -m 644 etc/conf.d/$_shortname "$pkgdir"/etc/conf.d/$_shortname
}

sha512sums="ec85f1907d23332c9342aa6e44edc9591fdd5f77501de7df39abdacff7482d942aa499ba70152b461f7ec2d77f72279710e55d14def483b69bdc39651b272008  alpine-git-mirror-syncd-0.3.1.tar.gz"
